package com.rui.study.algorithm.L_移位操作符;

/**
 * @program: study
 * @description:
 * @author: Yaowr
 * @create: 2019-03-12 08:02
 **/
public class TestShiftOperation {

    public static void main(String[] args) {
        System.out.println("MAX_INT : " + Integer.MAX_VALUE);
        System.out.println("MAX_INT_BINARY : " + Integer.toBinaryString(Integer.MAX_VALUE));
        System.out.println("MIN_INT : " + Integer.MIN_VALUE);
        System.out.println("MIN_INT_BINARY : " + Integer.toBinaryString(Integer.MIN_VALUE));

        System.out.println(Integer.valueOf("+1111111111111111111111111111111", 2));
        System.out.println(Integer.valueOf("-1111111111111111111111111111111", 2));
        System.out.println(Integer.valueOf("10000000000000000000000000000000", 2));
        System.out.println(Integer.valueOf("-0000000000000000000000000000011", 2));
        int i = -1;
        System.out.println("1 << 5 : " + Integer.toBinaryString(1 << 5));
        System.out.println("-1 << 5 : " + Integer.toBinaryString(-1 << 5));
//        System.out.println("1 * Math.pow(2, 5) : " + Integer.toBinaryString((int) (1 * Math.pow(2, 5))));
//        System.out.println("Math.sqrt(4) : " + Math.sqrt(4));

        System.out.println("1000000000 >> 5 : " + Integer.toBinaryString(Integer.valueOf("1000000000", 2) >> 5));
        System.out.println("1000000000 >>> 5 : " + Integer.toBinaryString(Integer.valueOf("1000000000", 2) >>> 5));
        System.out.println("-1000000000 >> 5 : " + Integer.toBinaryString(Integer.valueOf("-1000000000", 2) >> 5));
        System.out.println("-1000000000 >>> 5 : " + Integer.toBinaryString(Integer.valueOf("-1000000000", 2) >>> 5));
        System.out.println(Integer.valueOf("-1111111111111111111111111100000", 2));
        System.out.println(Integer.valueOf("111111111111111111111110000", 2));


        System.out.println(" 101011100 \n^ 10101110 : \n " + Integer.toBinaryString((Integer.valueOf("101011100", 2) ^ Integer.valueOf("10101110", 2))));


    }
}
